/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2012
 */

package com.smg.community.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javacommon.base.*;

import cn.org.rapid_framework.page.*;

import com.smg.community.model.CrmRoleRight;
import com.smg.community.vo.query.CrmRoleRightQuery;

/**
 * @author badqiu email:badqiu(a)gmail.com
 * @version 1.0
 * @since 1.0
 */


import org.springframework.stereotype.Repository;


@Repository
public class CrmRoleRightDao extends BaseIbatis3Dao<CrmRoleRight,java.lang.Integer>{
	
	@Override
	public String getIbatisMapperNamesapce() {
		return "CrmRoleRight";
	}
	
	public void saveOrUpdate(CrmRoleRight entity) {
		if(entity.getId() == null) 
			save(entity);
		else 
			update(entity);
	}
	public List<CrmRoleRight> getAll(){
		return this.getSqlSessionTemplate().selectList("CrmRoleRight.getAll",null);
	}
	public List<CrmRoleRight> getByRoleId(String roleId){
		Map<String, String> param = new HashMap<String, String>();
		param.put("roleId", roleId);
		return this.getSqlSessionTemplate().selectList("CrmRoleRight.getByRoleId",param);
	}
	public int deleteByRoleId(String roleId){
		Map<String, String> param = new HashMap<String, String>();
		param.put("roleId", roleId);
		return getSqlSessionTemplate().delete("CrmRoleRight.deleteByRoleId", param);
	}
	
	public Page findPage(CrmRoleRightQuery query) {
		return pageQuery("CrmRoleRight.findPage",query);
	}
	

}
